<?php

class Model_StaruserUser extends Model {

    function __construct() {
        
    }

    function getList() {
        $result = array();
        $param = array();
        $param['field'] = "TB1.mid,TB1.title,TB2.username,TB2.photo,TB2.member_type";
        $param['where'] = "TB1.status=1";
        $param['order'] = " sequence asc";
        $param['group'] = "";
        $param['limit'] = 10;
        $param['pagesize'] = 10;
        $param['page'] = 1;
        $param['join'] = "LEFT JOIN member_imore";
        $param['on'] = "TB1.mid = TB2.id";
        $data = db_query_hash('hilite_staruser_user', $param);


        if ($data['result']) {


            foreach ($data['result'] as $value) {
                $result[$value['mid']]['title'] = $value['title'];
                $result[$value['mid']]['username'] = $value['username'];
                $result[$value['mid']]['photo'] = $value['photo'];
                
                $result[$value['mid']]['report'] = array();

                $where = " is_blog=0 and mid=" . $value['mid'];

                $param = array();
                $param['field'] = "id,oid,mid,title,agegroup,content_json,body,(likes+likes_num_base) AS likes,well,category_score1,category_score2,category_score3,category_score4,category_score5,category_score6,category_score7,category_score8,is_valid,discuz_pid,is_accept,grade,reject_reason,sequence,priority,status,addtime,comments,body_skin,fb_share_num_base,is_publish,is_blog";
                $param['where'] = $where;
                $param['order'] = "id desc"; //"id asc"
                $param['group'] = "";
                $param['limit'] = 1;
                $param['pagesize'] = "";
                $param['page'] = "";
                $param['join'] = "";
                $param['on'] = "";
                $data_reports = db_query_hash('product_reports', $param);
                if ($data_reports['result']) {
                    $data_reports['result'][0]['member_type'] = $value['member_type'];
                    $result[$value['mid']]['report'] = $data_reports['result'][0];
                }
            }
        }

        return $result;
    }

}

?>